package com.agv.backend.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResult<T> {
    private String code;
    private String msg;
    private T data;

    public static <T> AjaxResult<T> success(T data) {
        return new AjaxResult<>("200", "操作成功", data);
    }

    public static AjaxResult success(String msg) {
        return new AjaxResult("200", msg, null);
    }

    public static <T> AjaxResult<T> success(String msg, T data) {
        return new AjaxResult<>("200", msg, data);
    }

    public static AjaxResult error(String msg) {
        return new AjaxResult("500", msg, null);
    }
}
